feat: add swagger-ui for lake#1900
Merged
Merged
Conversation
Contributor
|
This is an excellent implematation! |
Contributor
Author
|
ready for review! |
warren830
approved these changes
May 19, 2022
Contributor
warren830
left a comment
There was a problem hiding this comment.
Very nice job!
Keep going!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Key Points
Description
This is a Draft PR for checking my work of adding swagger-ui is OK and I've finished most of the work except for polishing the description of each annotation.
Using swagger-ui, first, we need to install
swag cliby$ go get -u github.com/swaggo/swag/cmd/swagalso , we need to add
swag clito the pathand also need two package
these have been written in go.mod.
My work is adding annotations to /api directory. In api.go,we need to do some basic settings and register swagger router.
In Controler Files, we also need to add annotations for each function.
After that , run
swag init --parseDependency --parseInternal -o ./api/docs -g ./api/api.goto generate swag-docs.--parseDependency --parseInternalaims to find models outside file.-o ./api/docssets the generated docs in ./api/dos directory and-g ./api/api.gomake swagger search api.go as an Enterance.the command will generate three files as
docs.go,swagger.jsonandswagger.yaml. These files are generated autolyand can be ignored in formal version by using CI/CD tools.
Then we can see swagger page by enter URL

http://localhost:8080/swagger/index.html#/. likeIn API we can see the input format and output format.

We can also try your own input data in this page.
Does this close any open issues?
related to #292
Current Behavior
finish most of this feat
New Behavior
continue processing the description.
Screenshots
Include any relevant screenshots here.
Other Information
Any other information that is important to this PR.